package com.fy.dao;

import com.fy.entity.Comments;
import org.apache.ibatis.annotations.*;
import org.mapstruct.Mapper;
import org.springframework.context.annotation.Bean;

import java.util.List;

@Mapper
public interface CommentsMapper {
    @Select("select * from comments")
    List<Comments> findAll();

    @Select("select * from  comments where co_id=#{co_id}")
    List<Comments> getInfo(@Param("co_id") String co_id);

    @Insert("insert into comments(co_id,info_id,co_info,for_id) values (#{co_id},#{info_id},#{co_info},#{for_id})")
    int insert_comments(@Param("co_id") String co_id, @Param("info_id") String info_id,
                        @Param("co_info") String co_info,
                        @Param("for_id") String for_id);

    @Delete("delete from comments where co_id=#{co_id}")
    int delete_comments(@Param("co_id") String co_id);
    @Update("update comments set co_info = #{co_info} where info_id=#{info_id}")
    int update_comments(@Param("co_info") String co_info,@Param("info_id") String info_id);

}

